{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## B 07-2 两独立样本均数比较的 $ t $ 检验\n",
    "\n",
    "适用于两互相独立的、来自服从正态分布的连续的总体的样本的均数比较。\n",
    "\n",
    "注意：两独立样本的 $ t $ 检验，需要满足两总体的方差相同————**方差齐性**。若方差不同，则需要使用 **Welch's t-test**.\n",
    "\n",
    "## 案例\n",
    "\n",
    "评估低氧环境对运动员心肌血流量的影响。\n",
    "\n",
    "### 数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><style>\n",
       ".dataframe > thead > tr,\n",
       ".dataframe > tbody > tr {\n",
       "  text-align: right;\n",
       "  white-space: pre-wrap;\n",
       "}\n",
       "</style>\n",
       "<small>shape: (17, 2)</small><table border=\"1\" class=\"dataframe\"><thead><tr><th>group</th><th>value</th></tr><tr><td>i64</td><td>f64</td></tr></thead><tbody><tr><td>1</td><td>3.5</td></tr><tr><td>1</td><td>3.1</td></tr><tr><td>1</td><td>3.1</td></tr><tr><td>1</td><td>2.7</td></tr><tr><td>1</td><td>2.5</td></tr><tr><td>&hellip;</td><td>&hellip;</td></tr><tr><td>2</td><td>5.3</td></tr><tr><td>2</td><td>5.1</td></tr><tr><td>2</td><td>4.9</td></tr><tr><td>2</td><td>4.7</td></tr><tr><td>2</td><td>3.5</td></tr></tbody></table></div>"
      ],
      "text/plain": [
       "shape: (17, 2)\n",
       "┌───────┬───────┐\n",
       "│ group ┆ value │\n",
       "│ ---   ┆ ---   │\n",
       "│ i64   ┆ f64   │\n",
       "╞═══════╪═══════╡\n",
       "│ 1     ┆ 3.5   │\n",
       "│ 1     ┆ 3.1   │\n",
       "│ 1     ┆ 3.1   │\n",
       "│ 1     ┆ 2.7   │\n",
       "│ 1     ┆ 2.5   │\n",
       "│ …     ┆ …     │\n",
       "│ 2     ┆ 5.3   │\n",
       "│ 2     ┆ 5.1   │\n",
       "│ 2     ┆ 4.9   │\n",
       "│ 2     ┆ 4.7   │\n",
       "│ 2     ┆ 3.5   │\n",
       "└───────┴───────┘"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import polars as pl\n",
    "\n",
    "lf = pl.read_csv(\"B_07_2-data.csv\").lazy()\n",
    "\n",
    "lf.collect()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "影响变量为二项分类变量，结果变量为数值变量，两样本对应的总体相互独立，可以用 t 检验推断样本对应总体的均值是否相等。\n",
    "\n",
    "### 假设\n",
    "\n",
    "- $ H_0 $: 正常含氧环境和低氧环境对运动者心肌血流量无影响，即 $ \\mu_1 = \\mu_2 $ .\n",
    "- $ H_1 $: 正常含氧环境和低氧环境对运动者心肌血流量有影响，即 $ \\mu_1 \\neq \\mu_2 $ .\n",
    "\n",
    "### 假设检验\n",
    "\n",
    "#### 方差齐性检验"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "F-statistic: 1.0615\n",
      "p-value: 0.3192\n",
      "Significance: False\n"
     ]
    }
   ],
   "source": [
    "from scipy.stats import levene\n",
    "\n",
    "x1 = lf.filter(pl.col(\"group\") == 1).select(\"value\")\n",
    "x2 = lf.filter(pl.col(\"group\") == 2).select(\"value\")\n",
    "\n",
    "res = levene(x1.collect(), x2.collect())\n",
    "\n",
    "print(\n",
    "    f\"\"\"F-statistic: {float(res.statistic[0]):.4f}\n",
    "p-value: {float(res.pvalue[0]):.4f}\n",
    "Significance: {res.pvalue[0] < 0.05}\"\"\"\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$ P > 0.05 $，有 95% 的把握认为两样本对应总体的方差相同。可以使用 t-test 来判断两组数据是否来自同一分布。\n",
    "\n",
    "#### t 检验"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "t-statistic: -7.5787\n",
      "p-value: 0.0000\n",
      "Significance: True\n"
     ]
    }
   ],
   "source": [
    "from scipy.stats import ttest_ind\n",
    "\n",
    "res = ttest_ind(x1.collect(), x2.collect(), equal_var=True)\n",
    "\n",
    "print(\n",
    "    f\"\"\"t-statistic: {float(res.statistic[0]):.4f}\n",
    "p-value: {float(res.pvalue[0]):.4f}\n",
    "Significance: {res.pvalue[0] < 0.05}\"\"\"\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$ P < 0.05 $，有 95% 的把握认为两样本对应总体的方差相等。可以使用 t-test 来判断两组数据是否来自同一分布。\n",
    "\n",
    "\n",
    "### Visualisation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAeQAAAHkCAYAAADvrlz5AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAmoElEQVR4nO3de3xU9Z3/8XcImWGSyYXkMdwVrMIQEMK42IgUq4AVkMcDLyUqRNsqihWCQstKW7zVFt0q60JAWgW8LIhG0dbtAhXTroppfaCm2AdiFsplV4QwppDMJEOu8/vDTX6GiUmczMz5MvN6Ph4+as6ZyyeDnRfnzDlnkoLBYFAAAMBSvaweAAAAEGQAAIxAkAEAMABBBgDAAAQZAAADEGQAAAxAkAEAMABBBgDAAHEf5MLCQhUWFlo9BgAAnept9QDRduzYMatHAACgS3G/hQwAwNmAIAMAYACCDACAAQgyAAAGIMgAABiAIAMAYACCDACAAQgyAAAGIMgAABiAIAMAYACCDACAAQgyAAAGIMgAABiAIAMAYIC4//pFAAC6y1fXoGp/vWoDjUpzpCjTaVd6qi0mz02QAQCQ5D0VU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eNIIshhy8jIUENDg+rr69v9zammpkZJSUnKzMy0cDqzlZSUaO3atfrlL3+pCRMmWD2OkVatWiW3263x48erpqZG0hef+zU1Nammpkapqakhn8knsoyMDElfRPjLJkyYoF//+tc6cuSI3G63FaMZ6b/+67+0Y8cOvf76622vS35+vqqqqvToo4/GfZBramp0++23KysrS8XFxZ1+Dh/L93o+Qw5T6+cJhw4darf84MGDGjRoEH8b/wo7d+7Ugw8+qEWLFum73/2u1eMY69ChQ9q9e7cuvvjitn8+/PBD7dq1SxdffLHKysqsHtEoF1xwQafr6+vrYzTJ2eHAgQNKTk7WiBEj2i3Pzc3ViRMnFAgELJos+k6fPq358+fL5/Np/fr1IQe2nSmW7/X8FTtMF110kZxOp7Zv366RI0dKkhobG/XGG2/osssus3g6M7333ntasmSJZs+erQULFlg9jtF++tOftm0Zt1qxYoX69OmjJUuWsLV3hsGDB2vEiBEqKytTYWFh2/KysjL16dOny2AnmsGDB6u5uVkVFRVt71/SFwfH5eTkyOFwWDhd9DQ1Nemee+7RwYMHtXnzZvXv37/L+8TyvZ4gSwoEAnrrrbckSUePHpXf79eOHTskSd/85jeVnZ2t733ve/rss8+0c+dOSZLdbtf8+fNVXFys7OxsjRgxQlu2bNGpU6d02223Wfa7xEI4r9ff//53LViwQMOGDdOsWbPaXeUmOztb5557bsx/j1gJ5/XKzc0NeZyMjAylpqYqPz8/dsNbIJzXS5IWL16su+66S7/85S91+eWX629/+5s2btyo2267La6PUwjn9brssss0aNAgLVq0SAsWLFC/fv20a9cuvfbaayoqKrLsd4m2hx56SH/605+0bNky+f3+du9Do0aNks1ms/S9niDriwNo7r777nbLWn9+/vnnlZ+fr5aWFjU3N7e7ze23365gMKiNGzfqH//4h3Jzc7Vhw4a4vkqXFN7rtWfPHvl8Pvl8Pt10003t7nvttdfq0Ucfjf7gFgn3v69EFe7rNXnyZP3rv/6rnnzySW3ZskX9+vVTUVGR7rjjjpjNboVwXi+n06lnn31WTzzxhB5//HH5fD4NGTJEy5Yta7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R1kDcWLhwoXatWuXbrrpJt10001qaWnRpk2bNHz4cO3bt6/L+99zzz0qKyvTnDlzNGfOHCUnJ+ull15SQ0ODli5d2na7iRMnatCgQfrZz36mgwcPKjk5WVu3blXfvn073EoeNmyYfvazn+lvf/ubcnJytHXrVlVVVemRRx6J6O8PnO3YQgbixIUXXqinn35amZmZWrVqlV555RUtWrRIEyZMkN1u7/L+w4cP1+bNmzV8+HD95je/0dq1azVo0CA9//zz7c5BTklJ0Zo1a3Tuuedq1apV+vd//3fNnj1bhYWFHT7usGHD9MQTT+itt97SypUr1dTUpCeeeKLDo7+BRJYUPPPDHQBx5a677tKBAwcsuTrW5MmT2wIPoHNsIQNx5PTp0+1+Pnz4sN5++21985vftGgiAN3FZ8hAHJk6daquvfZanXPOOTp69KhefPFFpaSkaN68eVaPBqALBBmII5MmTdJ//ud/yuv1ymazady4cVqyZEnbhTgAmIvPkAEAMACfIQMAYACCDACAAQgyAAAGIMgAABiAIAMAYACCDACAAQgyAAAGIMgAABiAIAMAYID/B5EM/Jc9/0PVAAAAAElFTkSuQmCC",
      "text/plain": [
       "<Figure size 500x500 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import seaborn as sns\n",
    "\n",
    "\n",
    "sns.set_theme(\"notebook\")\n",
    "sns.set_style(\"white\")\n",
    "\n",
    "rel = sns.relplot(data=lf.collect(), x=\"group\", y=\"value\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
